﻿package ua.mihaylenko.canvas.controller 
{
	import flash.events.Event;
	
	/**
	 * ...
	 * @author Mihayelnko A.L.
	 */
	public class CanvasEvent extends Event 
	{
		/// The Event.SELECT_FILE constant defines the value of the type property of a browse to load image.
		public static const SELECT_FILE:String = 'SelectFileCanvasEvent';
		public static const ENABLED_ON:String = 'SetEnabledOnCanvasEvent';
		public static const ENABLED_OFF:String = 'SetEnabledOffCanvasEvent';
		public static const FILE_CHANGE:String = 'OnFileChangeCanvasEvent';
		public static const VIEW_3D:String = 'OnView3DCanvasEvent';
		public static const VIEW_2D:String = 'OnView2DCanvasEvent';
		public static const CHANGE_IMAGE_SIZE:String = 'OnChangeImageSizeCanvasEvent';
		public static const CHANGE_CANVAS_SIZE:String = 'OnChangeImageSizeCanvasEvent';
		public static const HIDE_ALERT:String = 'hide_alert';
		public static const SHOW_ALERT:String = 'show_alert';
		private var _iPicture:int = 1;
		private var _iCanvas:int = 1;
		public function CanvasEvent(type:String, iPicture:int=1, iCanvas:int=1, bubbles:Boolean=false, cancelable:Boolean=false) 
		{ 
			super(type, bubbles, cancelable);
			
			if (type == CHANGE_IMAGE_SIZE) {
				_iPicture = iPicture;
			}
			if (type == CHANGE_CANVAS_SIZE) {
				_iCanvas = iCanvas;
			}
		} 
		
		public override function clone():Event 
		{ 
			return new CanvasEvent(type,_iPicture, _iCanvas, bubbles, cancelable);
		} 
		
		public override function toString():String 
		{ 
			return formatToString("CanvasEvent", "type", "bubbles", "cancelable", "eventPhase"); 
		}
		public function get pictureNum():int {
			return _iPicture;
		}
		public function set pictureNum(iValue:int) {
			_iPicture = iValue;
		}
		public function get canvasNum():int {
			return _iCanvas;
		}
		public function set canvasNum(iValue:int) {
			_iCanvas = iValue
		}
		
	}
	
}